package com.example.teamwork1.mapper;

import com.example.teamwork1.model.t_user;
import org.apache.ibatis.annotations.*;

@Mapper
public interface t_userMapper {

    @Select("select * from t_user WHERE username = #{username}")
    t_user findByUsername(@Param("username")String username);

    @Select("select * from t_user WHERE mail = #{mail}")
    t_user findByMail(@Param("mail")String mail);

    @Insert("INSERT INTO `hzudatabase`.`t_user` (`username`, `nickname`, `password`, `phone`, `mail`, `gender`) " +
            "VALUES (#{username}, #{nickname}, #{password}, #{phone}, #{mail}, #{gender})")
    int insert(String username,String nickname,String password,String phone,String mail,String gender);

    @Update("UPDATE `hzudatabase`.`t_user` SET `password` =#{password} WHERE `username` = #{username}")
    int updatePassword(String username, String password);

    @Update("UPDATE `hzudatabase`.`t_user` SET `CheckCode` =#{CheckCode} WHERE `mail` = #{mail}")
    void updateCheckCodeByEMail(String CheckCode,String mail);
}
